package com.markerhub.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.markerhub.entity.AppUserFeedback;
import com.markerhub.service.AppUserFeedbackService;
import com.markerhub.mapper.AppUserFeedbackMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 *
 */
@Service
public class AppUserFeedbackServiceImpl extends ServiceImpl<AppUserFeedbackMapper, AppUserFeedback>
    implements AppUserFeedbackService{

    @Override
    public void insert(AppUserFeedback mAppUserFeedback) {
        AppUserFeedback item=new AppUserFeedback();
        item.setUserId(mAppUserFeedback.getUserId());
        item.setFeedbackContent(mAppUserFeedback.getFeedbackContent());
        baseMapper.insert(mAppUserFeedback);

    }




    @Override
    public int delUserId(List<String> ids) {
        for (int k=0;k<ids.size();k++){
            Map<String, Object> map = new HashMap<>();
            map.put("id",ids.get(k));
            int flag = baseMapper.deleteByMap(map);
            if (k==ids.size()-1){
                return flag;
            }
        }
        return 1;
    }

    @Resource
    AppUserFeedbackMapper mAppBlueLabelMapper;


    @Override
    public Object pageAdmin(Page page, AppUserFeedback appOrder) {
        return mAppBlueLabelMapper.pageWithUserFeedBack(page, appOrder);
    }
}




